//
//  NetworkTools.m
//  ASR_Demo
//
//  Created by marco on 16/3/9.
//  Copyright © 2016年 Marco. All rights reserved.
//

#import "NetworkTools.h"
#import "AFNetworking.h"

@implementation NetworkTools

+ (NSURLSessionDataTask *)GET:(NSString *)url params:(NSDictionary *)params success:(RequestSuccess)success failure:(RequestFailure)failure
{
    return [[AFHTTPSessionManager manager] GET:url parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
        !success ? : success(responseObject);
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        !failure ? : failure(error);
    }];
}

+ (NSURLSessionDataTask *)POST:(NSString *)url params:(NSDictionary *)params success:(RequestSuccess)success failure:(RequestFailure)failure
{
    return [[AFHTTPSessionManager manager] POST:url parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
        !success ? : success(responseObject);
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        !failure ? : failure(error);
    }];
}


@end
